﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using Team6_Algorithms.HighEnd;
using Team6_Algorithms.AidingClasses;
using Team6_Algorithms.Operations;
using Team6_Algorithms.Binary;

namespace VisionApplication
{
    class CannyAlgo: VisionAlgorithm
    {

        public CannyAlgo(String name, string[] required) : base(name, required) { }

        public override System.Drawing.Bitmap DoAlgorithm(System.Drawing.Bitmap sourceImage, Object obj)
        {
            

            CannyEdge Can = new CannyEdge();
            Bitmap returnImage = Can.Run(sourceImage);
            PixelPoint[,] PP =(PixelPoint[,]) Binaryze.MakeBinairy(returnImage);
       //     PP = Dilation.Dilate(PP, settings.Size, returnImage.Width, returnImage.Height);
            returnImage = Binaryze.PaintBinairy(returnImage, PP);
            this.Image = returnImage;
         /*   Blob blob = BlobDetection.StartGrowing(PP, returnImage);

            int maxX = blob.Pixels.Max(x => x.xPos);
            int maxY = blob.Pixels.Max(x => x.yPos);
            int minX = blob.Pixels.Min(x => x.xPos);
            int minY = blob.Pixels.Min(x => x.yPos); 

            PixelPoint min = new PixelPoint(minX, minY, 0, 0, 0, 0, null);
            PixelPoint max = new PixelPoint(maxX, maxY, 0, 0, 0, 0, null);

            DrawRectangles.drawRectangle(sourceImage, min, max);
             */
            

            return sourceImage;;

        }
    }
}
